package buru.server.netty;

import org.glassfish.jersey.server.ApplicationHandler;
import org.glassfish.jersey.server.spi.ContainerProvider;

import javax.ws.rs.ProcessingException;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Provider;

/**
 * Auth: bruce-sha
 * Date: 2015/3/31
 */
@Provider
public class NettyHandlerJerseyContainerProvider implements ContainerProvider {

    public <T> T createContainer(Class<T> type, Application application) throws ProcessingException {
        if (type != NettyHandlerJerseyContainer.class) return null;
        return type.cast(new NettyHandlerJerseyContainer(new ApplicationHandler(application)));
    }

}